# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
# Contributor: Konstantin Gizdov <arch at kge dot pw>

pkgname=intel-oneapi-compiler-shared
pkgver=2023.0.0
_debpkgrel=25370
pkgrel=1
pkgdesc='Intel oneAPI compiler runtime libraries'
arch=('loong64' 'x86_64')
url='https://software.intel.com/content/www/us/en/develop/tools/oneapi.html'
license=("custom")
source=("https://apt.repos.intel.com/oneapi/pool/main/${pkgname}-${pkgver}-${pkgver}-${_debpkgrel}_amd64.deb")
b2sums=('41d60790038783f6691b982830d75db00a68fd89789f508d48b931cb08029372cf07b26f66fc2513216098bdc35454f325dc426ec48b2a735c6080bdcf207d78')
depends=('intel-oneapi-compiler-shared-common' 'intel-oneapi-compiler-shared-runtime'
         'intel-oneapi-dpcpp-debugger' 'intel-oneapi-common')
provides=("${pkgname}-common")
conflicts=('intel-oneapi-basekit')

noextract=(
    "${pkgname}-${pkgver}-${pkgver}-${_debpkgrel}_amd64.deb"
)

package() {
    cd "${srcdir}"
    ar x "${srcdir}/${pkgname}-${pkgver}-${pkgver}-${_debpkgrel}_amd64.deb"
    tar xvf data.tar.xz -C "${pkgdir}"
    rm data.tar.xz
    # Remove symlink already created by intel-oneapi-compiler-shared-runtime
    rm "${pkgdir}/opt/intel/oneapi/compiler/${pkgver}/linux/compiler/lib/intel64"

    install -d "${pkgdir}"/usr/share/licenses/"${pkgname}"
    ln -s /usr/share/licenses/intel-oneapi "${pkgdir}"/usr/share/licenses/"${pkgname}"/oneapi
}
